* along with this program; if not, write to the Free Software
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Copyright (C) IBM Corp. 2005
+ * Copyright (C) IBM Corp. 2005, 2006
*
* Authors: Jimi Xenidis <jimix@watson.ibm.com>
*/
if (n == OF_FAILURE) {
of_panic("instance-to-package of /chosen/stdout: failed\n");
}
+
+ /* Prune all serial devices from the device tree, including the
+ * one pointed to by /chosen/stdout, because a guest domain can
+ * initialize them and in so doing corrupt our console output.
+ */
+ for (p = n; p > 0; p = of_getpeer(p)) {
+ char type[32];
- /* prune this from the oftree */
- rc = of_package_to_path(n, buf, sizeof(buf));
- if (rc == OF_FAILURE) {
- of_panic("package-to-path of /chosen/stdout: failed\n");
- }
- of_printf("Pruning from devtree: %s\n"
- " since Xen will be using it for console\n", buf);
- rc = ofd_prune_path(oftree, buf);
- if (rc < 0) {
- of_panic("prune path \"%s\" failed\n", buf);
+ rc = of_package_to_path(p, buf, sizeof(buf));
+ if (rc == OF_FAILURE)
+ of_panic("package-to-path failed\n");
+
+ rc = of_getprop(p, "device_type", type, sizeof (type));
+ if (rc == OF_FAILURE)
+ of_panic("fetching device type failed\n");
+
+ if (strcmp(type, "serial") != 0)
+ continue;
+
+ of_printf("pruning `%s' from devtree\n", buf);
+ rc = ofd_prune_path(oftree, buf);
+ if (rc < 0)
+ of_panic("prune of `%s' failed\n", buf);
}
-
p = of_getparent(n);
if (p == OF_FAILURE) {
if (rc == OF_FAILURE) {
of_panic("%s: no location for serial port\n", __func__);
}
- ns16550.io_base = val[1];
ns16550.baud = BAUD_AUTO;
ns16550.data_bits = 8;
if ((mbi->flags & MBI_CMDLINE) && (mbi->cmdline != 0))
cmdline_parse(__va((ulong)mbi->cmdline));
+ /* We initialise the serial devices very early so we can get debugging. */
+ ns16550.io_base = 0x3f8;
ns16550_init(0, &ns16550);
+ ns16550.io_base = 0x2f8;
+ ns16550_init(1, &ns16550);
serial_init_preirq();
init_console();